package com.example.communist_app_api.service.impl;

import com.example.communist_app_api.db.dao.CommentDao;
import com.example.communist_app_api.db.pojoDto.Comment;
import com.example.communist_app_api.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentDao commentDao;

    @Override
    public List<Comment> getAllComment(Integer id) {
        List<Comment> list = commentDao.getAllComment(id);
        return list;
    }

    @Override
    public int insertComment(Comment comment) {
        return commentDao.insertComment(comment);
    }

    @Override
    public boolean deleteComment(Integer id) {
        return commentDao.deleteComment(id);
    }

    @Override
    public boolean UpdateLikeNum(Integer id) {
        return commentDao.UpdateLikeNum(id);
    }

    @Override
    public int insertNoComment(Integer userId, Integer articleId, String context) {
        return commentDao.insertNoComment(userId,articleId,context);
    }

    @Override
    public boolean deleteLikeNum(Integer id) {
        return commentDao.deleteLikeNum(id);
    }

    @Override
    public List<Comment> getUnmoderatdeComment() {
        return commentDao.getUnmoderatdeComment();
    }

    @Override
    public boolean reviewComments(Integer userId, Integer id) {
        return commentDao.reviewComments(userId, id);
    }

    @Override
    public List<Comment> getComment() {
        return commentDao.getComment();
    }
}
